package com.bear.atlassianmcp.jira.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.time.Duration;

/**
 * Jira连接配置属性
 */
@Component
@ConfigurationProperties(prefix = "jira")
public class JiraProperties {
    
    /**
     * Jira服务器基础URL
     */
    private String baseUrl;
    
    /**
     * 用户名
     */
    private String username;
    
    /**
     * 密码
     */
    private String password;
    
    /**
     * API版本，默认为2
     */
    private String apiVersion = "2";
    
    /**
     * 请求超时时间
     */
    private Duration timeout = Duration.ofSeconds(30);
    
    /**
     * 搜索结果最大数量
     */
    private Integer maxResults = 50;

    // Getters and Setters
    public String getBaseUrl() {
        return baseUrl;
    }

    public void setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getApiVersion() {
        return apiVersion;
    }

    public void setApiVersion(String apiVersion) {
        this.apiVersion = apiVersion;
    }

    public Duration getTimeout() {
        return timeout;
    }

    public void setTimeout(Duration timeout) {
        this.timeout = timeout;
    }

    public Integer getMaxResults() {
        return maxResults;
    }

    public void setMaxResults(Integer maxResults) {
        this.maxResults = maxResults;
    }

    /**
     * 获取完整的API基础URL
     */
    public String getApiBaseUrl() {
        return baseUrl + "/rest/api/" + apiVersion;
    }
}
